import type { OrderStatus, OrderType } from '@/types/enum'

interface FetchOrderDetailAPIResData {
  code: number
  msg: string
  time: string
  data: {
    driver_status: OrderStatus
    reson: string
    remark: string
    id: number
    user_id: number
    order_number: string
    city: string
    start_place: string
    start_place_lat: string
    start_place_lng: string
    end_place: string
    end_place_lat: string
    end_place_lng: string
    transaction_id: string
    refund_number: string
    money: string
    pay_money: string
    coupon_id: string
    is_pay: number
    create_time: number
    pay_time: number
    order_cannel_time: number
    cannel_reason: string
    is_comment: 0
    distance: string
    type: OrderType
    num: number
    start_time: string
    passengers_mobile: string
    passengers_name: string
    pronoun_name: string
    pronoun_mobile: string
    priority_contact: string
    image: string
    goods_type: string
    is_invoice: number
    invoice_id: number
    start_price: string
    start_kilomate: string
    complete_money: string
    check_time: number
    check_refuse_reason: string
    recrive_time: number
    arrived_time: number
    finish_time: number
    return_money: string
    driverid: number
  }
}

interface FetchOrderDetailAPIParams {
  orderid: string
}

export function fetchOrderDetailAPI(params: FetchOrderDetailAPIParams, token: string) {
  return httpInstance.get<FetchOrderDetailAPIResData, FetchOrderDetailAPIParams>(
    '/api/driver/driverOrderInfo',
    { params, headers: { token } },
  )
}
